package com.gree.changying.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListView;

public class BottomSheetListView extends ListView {
    public BottomSheetListView(Context context) {
        super(context);
    }

    public BottomSheetListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public BottomSheetListView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        int firstVisiblePos = getFirstVisiblePosition();
        switch (ev.getAction()) {
            case MotionEvent.ACTION_MOVE:
                if (firstVisiblePos == 0) {
                    requestDisallowInterceptTouchEvent(false);
                    break;
                }
                requestDisallowInterceptTouchEvent(true);
                break;
        }
        return super.onTouchEvent(ev);
    }
}
